package cn.meibang.meibanguserskillstype.provider.base;

import cn.apestar.core.base.GenericMapper;
import cn.apestar.core.base.MapperAnnotation;
import cn.meibang.meibanguserskillstype.provider.domain.MeibangUserSkillsType;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;

/**
 * 技师技能细类型 Dao 层
 *
 * @author yudw
 * @version 1.0
 */

@MapperAnnotation public interface BaseMeibangUserSkillsTypeMapper
    extends GenericMapper<MeibangUserSkillsType, Long> {

    @Delete({"delete from meibang_user_skills_type", "where id = #{id,jdbcType=BIGINT}"})
    int deleteByPrimaryKey(Long id);

    @Insert({"insert into meibang_user_skills_type (", "type,", "level,", "level1,", "skills,",
        "user_id,", "remark,", "create_date,", "update_date,", "create_by,", "update_by,",
        "del_flag", " )values(", "#{type,jdbcType=VARCHAR},", "#{level,jdbcType=VARCHAR},",
        "#{level1,jdbcType=VARCHAR},", "#{skills,jdbcType=VARCHAR},", "#{userId,jdbcType=BIGINT},",
        "#{remark,jdbcType=VARCHAR},", "#{createDate,jdbcType=DATE},",
        "#{updateDate,jdbcType=DATE},", "#{createBy,jdbcType=BIGINT},",
        "#{updateBy,jdbcType=BIGINT},", "#{delFlag,jdbcType=VARCHAR})"}) int insert(
        MeibangUserSkillsType record);

    @InsertProvider(type = BaseMeibangUserSkillsTypeSqlProvider.class, method = "insertSelective")
    int insertSelective(MeibangUserSkillsType record);

    @Select({"select", "type,", "level,", "level1,", "skills,", "user_id,", "remark,",
        "create_date,", "update_date,", "create_by,", "update_by,", "del_flag",
        "from meibang_user_skills_type", "where id = #{id,jdbcType=BIGINT}"})
    @Results({@Result(column = "id", property = "id", jdbcType = JdbcType.BIGINT, id = true),
        @Result(column = "type", property = "type", jdbcType = JdbcType.VARCHAR),
        @Result(column = "level", property = "level", jdbcType = JdbcType.VARCHAR),
        @Result(column = "level1", property = "level1", jdbcType = JdbcType.VARCHAR),
        @Result(column = "skills", property = "skills", jdbcType = JdbcType.VARCHAR),
        @Result(column = "user_id", property = "userId", jdbcType = JdbcType.BIGINT),
        @Result(column = "remark", property = "remark", jdbcType = JdbcType.VARCHAR),
        @Result(column = "create_date", property = "createDate", jdbcType = JdbcType.DATE),
        @Result(column = "update_date", property = "updateDate", jdbcType = JdbcType.DATE),
        @Result(column = "create_by", property = "createBy", jdbcType = JdbcType.BIGINT),
        @Result(column = "update_by", property = "updateBy", jdbcType = JdbcType.BIGINT),
        @Result(column = "del_flag", property = "delFlag", jdbcType = JdbcType.VARCHAR)})
    MeibangUserSkillsType selectByPrimaryKey(Long id);

    @UpdateProvider(type = BaseMeibangUserSkillsTypeSqlProvider.class, method = "updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(MeibangUserSkillsType record);

    @Update({"update meibang_user_skills_type", "set ", "type = #{type,jdbcType=VARCHAR},",
        "level = #{level,jdbcType=VARCHAR},", "level1 = #{level1,jdbcType=VARCHAR},",
        "skills = #{skills,jdbcType=VARCHAR},", "user_id = #{userId,jdbcType=BIGINT},",
        "remark = #{remark,jdbcType=VARCHAR},", "create_date = #{createDate,jdbcType=DATE},",
        "update_date = #{updateDate,jdbcType=DATE},", "create_by = #{createBy,jdbcType=BIGINT},",
        "update_by = #{updateBy,jdbcType=BIGINT},", "del_flag = #{delFlag,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=BIGINT}"}) int updateByPrimaryKey(MeibangUserSkillsType record);
}